Schema Directives
https://www.graphql-tools.com/docs/schema-directives
GraphQL Schemaの定義内に出てくる@で始まるdecorator
例
code:graphql
directive @deprecated(
reason: String = "No longer supported"
) on FIELD_DEFINITION | ENUM_VALUE
type ExampleType {
newField: String
oldField: String @deprecated(reason: "Use newField.")
}
Code Firstなlibraryでは使えない?
TypeGraphQLとNexusで、これをサポートするようにissueが出てるけど、まだ解決されていないっぽい
GraphQL specifivatonにあるDirectivesの例
http://spec.graphql.org/June2018/#sec-Type-System.Directives
@deprecated
@skip
@include
何が嬉しいか?
https://www.apollographql.com/docs/apollo-server/schema/directives/
https://ariadnegraphql.org/docs/schema-directives